{extend name="public:layout" /}
{block name="title"}订单数量统计{/block}
{block name="head"}
<script src="/public/plugins/jsAddress/jsAddress.js"></script>
<script src="/public/plugins/echarts/echarts-all.js"></script>
{/block}
{block name="body"}
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> 订单数量统计</li>
            </ol>
        </div>
        <div class="ibox-content">
            <ul class="nav nav-tabs" id="tab_search">
                <li {eq name="query.time_type" value="0"}class="active"{/eq}><a href="{:url('ordercount',['time_type'=>0])}">总订单数</a></li>
                <li {eq name="query.time_type" value="5"}class="active"{/eq}><a href="{:url('ordercount',['time_type'=>5])}">时间段</a></li>
                <li {eq name="query.time_type" value="1"}class="active"{/eq}><a href="{:url('ordercount',['time_type'=>1])}">今日</a></li>
                <li {eq name="query.time_type" value="2"}class="active"{/eq}><a href="{:url('ordercount',['time_type'=>2])}">本周</a></li>
                <li {eq name="query.time_type" value="3"}class="active"{/eq}><a href="{:url('ordercount',['time_type'=>3])}">本月</a></li>
                <li {eq name="query.time_type" value="4"}class="active"{/eq}><a href="{:url('ordercount',['time_type'=>4])}">本年度</a></li>
            </ul>
            <div class="p8">
                <div class="toolbar" style="{neq name="query.time_type" value="5"}display:none;{/neq}">
                    <form class="form-inline" method="post">
                        <div class="form-group">
                            <label>时间段</label>
                            <input type="text" class="form-control laydate" style="width:150px;" name="bdate" value="{$query.bdate}" />
                            <input type="text" class="form-control laydate" style="width:150px;" name="edate" value="{$query.edate}" />
                        </div>
                        <button type="submit" class="btn btn-info">
                            <i class="fa fa-search"></i> 搜索
                        </button>
                        <a class="btn btn-white" href="{:url('ordercount',['mid'=>$Request.param.mid])}">
                            <i class="fa fa-trash"></i> 清空
                        </a>
                    </form>
                </div>
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title"><h5>柱状图</h5></div>
                        <div class="ibox-content">
                            <div class="echarts" id="echarts-bar-chart"></div>
                        </div>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    //订单概况
    $(function () {
        formatDate();
        var horizontal = {$horizontal};
        var type = {$type};
        var info = {$info};
        var barChart = echarts.init(document.getElementById("echarts-bar-chart"));
        var baroption = {
            title : {
                text: '总订单金额统计'
            },
            tooltip : {
                trigger: 'axis'
            },
            legend: {
                data:['已完成','积分','集采','竞拍','退款']
            },
            grid:{
                x:100,
                x2:80,
                y2:25
            },
            calculable : true,
            xAxis : [
                {
                    type : 'category',
                    data : horizontal
                }
            ],
            yAxis : [
                {
                    type : 'value'
                }
            ],
            series : [
                {
                    name:'已完成',
                    type:type,
                    data:info[0],
                    markLine : {
                        data : [
                            {type : 'average', name: '平均值'}
                        ]
                    }
                },
                {
                    name:'积分',
                    type:type,
                    data:info[1],
                    markLine : {
                        data : [
                            {type : 'average', name : '平均值'}
                        ]
                    }
                },
                {
                    name:'集采',
                    type:type,
                    data:info[2],
                    markLine : {
                        data : [
                            {type : 'average', name : '平均值'}
                        ]
                    }
                },
                {
                    name:'竞拍',
                    type:type,
                    data:info[3],
                    markLine : {
                        data : [
                            {type : 'average', name : '平均值'}
                        ]
                    }
                },
                {
                    name:'退款',
                    type:type,
                    data:info[4],
                    markLine : {
                        data : [
                            {type : 'average', name : '平均值'}
                        ]
                    }
                }
            ]
        };
        barChart.setOption(baroption);
        window.onresize = barChart.resize;
    })
</script>
{/block}